package models
{
	import events.URLEvent;
	
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import flash.events.IEventDispatcher;
	import flash.net.SharedObject;
	
	import mx.collections.ArrayCollection;
	
	public class FeedURLListPresentationModel extends EventDispatcher
	{
		private static const MODEL_CHANGE:String = "FeedURLListModelCHANGE";
		
		private var _feedList:ArrayCollection;
		private var dispatcher:IEventDispatcher;
		
		public function FeedURLListPresentationModel(target:IEventDispatcher)
		{
			dispatcher = target;
			super(target);
		}
		
		[Bindable(event=MODEL_CHANGE)]
		public function get feedList():ArrayCollection
		{
			return new ArrayCollection();
		}
		
		public function set feedList(value:ArrayCollection):void
		{
			_feedList = value;
			dispatcher.dispatchEvent(new Event(MODEL_CHANGE));
		}
		
		public function addURL(URL:String):void
		{
			var newEvent:URLEvent = new URLEvent(URLEvent.ADD);
			newEvent.URL = URL;
			dispatcher.dispatchEvent(newEvent);
		}
		
		public function removeURL(URL:String):void
		{
			var newEvent:URLEvent = new URLEvent(URLEvent.REMOVE);
			newEvent.URL = URL;
			dispatcher.dispatchEvent(newEvent);
		}
	}
}
